<?php 
	require_once("includes/connect.php");
	require_once("includes/function.php");

	$pet_id = $_REQUEST["pet_id"];
	$petition_type = $_REQUEST["petition_type"];

	//echo $pet_id, $petition_type;
	
	if (isset($petition_type)) {
	switch($petition_type) {
		case "salary":
			//$sql = "";
			$tablename = "tbl_salary";
			$where = "pet_id = '$pet_id'";
			break;
	}
	$db = new myDBS;
	$db->selectDB("account");
	
	$result = $db->showData1($tablename, $where);
	
?>
<table class="table" width="100%" >
	<caption><br></caption>
	<thead>
		<tr>
			<th>ตรวจฎีกา</th>
			<th>วันที่ตรวจฎีกา</th>
			<th>สถานะอนุมัติฎีกา</th>
			<th>วันที่อนุมัติฎีกา</th>
			<th>สถานะอนุมัติเช็ค</th>
			<th>วันที่อนุมัติเช็ค</th>
		</tr>
	</thead>
	<tbody>
		
		<?php
			$rows = $db->fetch_object ( $result );
		?>
		<tr>
		  <td><?php echo $rows->verify_status; ?></td>
		  <td>
		  <?php 
			echo $rows->verify_date;
			/*
			if (isset($rows->verify_date)) {
				$date = date_create($rows->verify_date);
				echo date_format($date, "d/m/Y"); 
			} else {
				echo "&nbsp;";
			}
			*/
		  ?>
		  </td>
		  <td><?php echo $rows->approved_status; ?></td>
		  <td>
		  <?php 
			$date = date_create($rows->approved_date);
			echo date_format($date, "d/m/Y"); 
		  ?>
		  </td>
		  <td><?php echo $rows->cheque_status; ?></td>
		  <td>
		  <?php 
			$date = date_create($rows->cheque_date);
			echo date_format($date, "d/m/Y"); 
		  ?>
		  </td>
		</tr>

	</tbody>

</table>

<?php
	}
?>

<div class="form-actions">

	<a href="#" class="btn close-dialog"><i class="icon-remove"></i> ปิดหน้าต่าง</a>

</div>
